package com.ruoyi.xdata.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.xdata.mapper.XdataDatasourceMapper;
import com.ruoyi.xdata.domain.XdataDatasource;
import com.ruoyi.xdata.service.IXdataDatasourceService;

/**
 * 数据源Service业务层处理
 * 
 * @author yepanpan
 * @date 2025-02-24
 */
@Service
public class XdataDatasourceServiceImpl implements IXdataDatasourceService 
{
    private static final Logger log = LoggerFactory.getLogger(XdataDatasourceServiceImpl.class);

    @Autowired
    private XdataDatasourceMapper xdataDatasourceMapper;

    /**
     * 查询数据源
     * 
     * @param id 数据源主键
     * @return 数据源
     */
    @Override
    public XdataDatasource selectXdataDatasourceById(Long id)
    {
        return xdataDatasourceMapper.selectXdataDatasourceById(id);
    }

    /**
     * 查询数据源列表
     * 
     * @param xdataDatasource 数据源
     * @return 数据源
     */
    @Override
    public List<XdataDatasource> selectXdataDatasourceList(XdataDatasource xdataDatasource)
    {
        return xdataDatasourceMapper.selectXdataDatasourceList(xdataDatasource);
    }

    /**
     * 新增数据源
     * 
     * @param xdataDatasource 数据源
     * @return 结果
     */
    @Override
    public int insertXdataDatasource(XdataDatasource xdataDatasource)
    {
        xdataDatasource.setCreateTime(DateUtils.getNowDate());
        return xdataDatasourceMapper.insertXdataDatasource(xdataDatasource);
    }

    /**
     * 修改数据源
     * 
     * @param xdataDatasource 数据源
     * @return 结果
     */
    @Override
    public int updateXdataDatasource(XdataDatasource xdataDatasource)
    {
        xdataDatasource.setUpdateTime(DateUtils.getNowDate());
        return xdataDatasourceMapper.updateXdataDatasource(xdataDatasource);
    }

    /**
     * 批量删除数据源
     * 
     * @param ids 需要删除的数据源主键
     * @return 结果
     */
    @Override
    public int deleteXdataDatasourceByIds(Long[] ids)
    {
        return xdataDatasourceMapper.deleteXdataDatasourceByIds(ids);
    }

    /**
     * 删除数据源信息
     * 
     * @param id 数据源主键
     * @return 结果
     */
    @Override
    public int deleteXdataDatasourceById(Long id)
    {
        return xdataDatasourceMapper.deleteXdataDatasourceById(id);
    }


}
